class_name WeaponContainer
extends Node2D


@onready var one: Node2D = $One
@onready var two: Node2D = $Two
@onready var three: Node2D = $Three
@onready var four: Node2D = $Four
@onready var five: Node2D = $Five
@onready var six: Node2D = $Six




func _ready():
	pass


## 更新武器位置
func update_weapon_position(weapons: Array[WeaponBase]):
	var ref_node: Node2D = null
	var count := weapons.size()
	match count:
		1: ref_node = one
		2: ref_node = two
		3: ref_node = three
		4: ref_node = four
		5: ref_node = five
		6: ref_node = six
	if not ref_node:
		prints("weapon size invalid")
		return
	var markers := ref_node.get_children()
	if markers.size() != count:
		prints("weapon size and markers are mismatched")
		return

	for i in count:
		var marker := markers[i] as Marker2D
		weapons[i].global_position = marker.global_position
